<?php
$string=$this->string;
$separator=$this->separator==''?'-':$this->separator;
$replace_char=$this->replace_char==''?' ':$this->replace_char;
if ($string != '')
{
	$string = trim ( $string );
	$string = preg_replace ( '/\s\s+/', ' ', $string );
	$string = str_replace ( array ("\r\n", "\r", "\t", "\n" ), ' ', $string );
	$string = mb_convert_case ( $string, MB_CASE_LOWER, 'utf-8' );
	$chars = array ('a' => array ('a', 'á', 'à', 'ả', 'ạ', 'ã', 'â', 'ấ', 'ầ', 'ẩ', 'ậ', 'ẫ', 'ă', 'ắ', 'ằ', 'ẳ', 'ặ', 'ẵ' ), 
				'b' => array ('b' ), 
				'c' => array ('c' ), 
				'd' => array ('d', 'đ' ), 
				'e' => array ('e', 'é', 'è', 'ẻ', 'ẹ', 'ẽ', 'ê', 'ế', 'ề', 'ể', 'ệ', 'ễ' ), 
				'f' => array ('f' ), 
				'g' => array ('g' ), 
				'h' => array ('h' ), 
				'j' => array ('j' ), 
				'k' => array ('k' ), 
				'l' => array ('l' ), 
				'm' => array ('m' ), 
				'n' => array ('n' ), 
				'i' => array ('i', 'í', 'ì', 'ỉ', 'ị', 'ĩ' ), 
				'o' => array ('o', 'ó', 'ò', 'ỏ', 'ọ', 'õ', 'ơ', 'ớ', 'ờ', 'ở', 'ợ', 'ỡ', 'ô', 'ố', 'ồ', 'ổ', 'ộ', 'ỗ' ), 
				'u' => array ('u', 'ú', 'ù', 'ủ', 'ụ', 'ũ', 'ư', 'ư', 'ừ', 'ử', 'ự', 'ữ' ), 
				'y' => array ('y', 'ý', 'ỳ', 'ỵ', 'ỷ', 'ỹ' ), 
				'q' => array ('q' ), 
				'w' => array ('w' ), 
				'r' => array ('r' ), 
				't' => array ('t' ), 
				'p' => array ('p' ), 
				's' => array ('s' ), 
				'z' => array ('z' ), 
				'x' => array ('x' ), 
				'v' => array ('v' ) );
	foreach ( $chars as $k => $v )
		$string = str_replace ( $v, $k, $string );
	if ($separator != '')
		$string = str_replace ( $replace_char, $separator, $string );
	$string = preg_replace ( '/[^a-z0-9\s-.]/i', NULL, $string );
}
echo $string;
?>